package com.yanmaohu.nikita.data.function.statement;

import com.yanmaohu.nikita.data.expression.Expression;
import com.yanmaohu.nikita.data.function.FunctionBody;
import com.yanmaohu.nikita.data.function.Interval;
import com.yanmaohu.nikita.data.function.LocalVariableModifier;

/**
 * @author Bright Lee
 *
 * 1. for (a [, index] : {collection | interval}) {...}<br/>
 * 2. for (a; b; c) {...}
 */
public final class ForStatement extends LoopStatement {

    private LocalVariableModifier aModifier;
    private Expression a;
    private LocalVariableModifier indexModifier;
    private Expression index;
    private Expression collection;
    private Interval interval;
    private Expression b;
    private Expression c;
    private FunctionBody functionBody;

    public ForStatement(int beginIndex,
                        int endIndex,
                        LocalVariableModifier aModifier,
                        Expression a,
                        Expression collection,
                        FunctionBody functionBody) {
        super(beginIndex, endIndex);
        this.aModifier = aModifier;
        this.a = a;
        this.collection = collection;
        this.functionBody = functionBody;
    }

    public ForStatement(int beginIndex,
                        int endIndex,
                        LocalVariableModifier aModifier,
                        Expression a,
                        Interval interval,
                        FunctionBody functionBody) {
        super(beginIndex, endIndex);
        this.aModifier = aModifier;
        this.a = a;
        this.interval = interval;
        this.functionBody = functionBody;
    }

    public ForStatement(int beginIndex,
                        int endIndex,
                        LocalVariableModifier aModifier,
                        Expression a,
                        LocalVariableModifier indexModifier,
                        Expression index,
                        Expression collection,
                        FunctionBody functionBody) {
        super(beginIndex, endIndex);
        this.aModifier = aModifier;
        this.a = a;
        this.indexModifier = indexModifier;
        this.index = index;
        this.collection = collection;
        this.functionBody = functionBody;
    }

    public ForStatement(int beginIndex,
                        int endIndex,
                        LocalVariableModifier aModifier,
                        Expression a,
                        LocalVariableModifier indexModifier,
                        Expression index,
                        Interval interval,
                        FunctionBody functionBody) {
        super(beginIndex, endIndex);
        this.aModifier = aModifier;
        this.a = a;
        this.indexModifier = indexModifier;
        this.index = index;
        this.interval = interval;
        this.functionBody = functionBody;
    }

    public ForStatement(int beginIndex,
                        int endIndex,
                        LocalVariableModifier aModifier,
                        Expression a,
                        Expression b,
                        Expression c,
                        FunctionBody functionBody) {
        super(beginIndex, endIndex);
        this.aModifier = aModifier;
        this.a = a;
        this.b = b;
        this.c = c;
        this.functionBody = functionBody;
    }

    public LocalVariableModifier getaModifier() {
        return aModifier;
    }

    public Expression getA() {
        return a;
    }

    public LocalVariableModifier getIndexModifier() {
        return indexModifier;
    }

    public Expression getIndex() {
        return index;
    }

    public Expression getCollection() {
        return collection;
    }

    public Interval getInterval() {
        return interval;
    }

    public Expression getB() {
        return b;
    }

    public Expression getC() {
        return c;
    }

    public FunctionBody getStatementList() {
        return functionBody;
    }

}
